﻿using System;
using SharpSqlAnalyzer.nodes;
using SharpSqlAnalyzer.nodes.hive;
using SharpSqlAnalyzer.nodes.mssql;

namespace SharpSqlAnalyzer.stmt
{
	// Token: 0x02000091 RID: 145
	public class TCreateDatabaseSqlStatement : TCustomSqlStatement
	{
		// Token: 0x1700006B RID: 107
		// (get) Token: 0x060003CF RID: 975 RVA: 0x002FA482 File Offset: 0x002F8682
		// (set) Token: 0x060003D0 RID: 976 RVA: 0x002FA48A File Offset: 0x002F868A
		public TObjectName characterSet
		{
			get
			{
				return this._characterSet;
			}
			set
			{
				this._characterSet = value;
			}
		}

		// Token: 0x1700006C RID: 108
		// (get) Token: 0x060003D1 RID: 977 RVA: 0x002FA493 File Offset: 0x002F8693
		// (set) Token: 0x060003D2 RID: 978 RVA: 0x002FA49B File Offset: 0x002F869B
		public TObjectName collationName
		{
			get
			{
				return this._collationName;
			}
			set
			{
				this._collationName = value;
			}
		}

		// Token: 0x1700006D RID: 109
		// (get) Token: 0x060003D3 RID: 979 RVA: 0x002FA4A4 File Offset: 0x002F86A4
		// (set) Token: 0x060003D4 RID: 980 RVA: 0x002FA4AC File Offset: 0x002F86AC
		public virtual TObjectName DbOwner
		{
			get
			{
				return this.dbOwner;
			}
			set
			{
				this.dbOwner = value;
			}
		}

		// Token: 0x1700006E RID: 110
		// (get) Token: 0x060003D5 RID: 981 RVA: 0x002FA4B5 File Offset: 0x002F86B5
		public virtual TSourceToken Database
		{
			get
			{
				return this.database;
			}
		}

		// Token: 0x1700006F RID: 111
		// (get) Token: 0x060003D6 RID: 982 RVA: 0x002FA4BD File Offset: 0x002F86BD
		// (set) Token: 0x060003D7 RID: 983 RVA: 0x002FA4C5 File Offset: 0x002F86C5
		public virtual TObjectName DatabaseComment
		{
			get
			{
				return this.databaseComment;
			}
			set
			{
				this.databaseComment = value;
			}
		}

		// Token: 0x17000070 RID: 112
		// (get) Token: 0x060003D8 RID: 984 RVA: 0x002FA4CE File Offset: 0x002F86CE
		// (set) Token: 0x060003D9 RID: 985 RVA: 0x002FA4D6 File Offset: 0x002F86D6
		public virtual TObjectName DbLocation
		{
			get
			{
				return this.dbLocation;
			}
			set
			{
				this.dbLocation = value;
			}
		}

		// Token: 0x17000071 RID: 113
		// (get) Token: 0x060003DA RID: 986 RVA: 0x002FA4DF File Offset: 0x002F86DF
		// (set) Token: 0x060003DB RID: 987 RVA: 0x002FA4E7 File Offset: 0x002F86E7
		public virtual THiveWithDBPropertiesClause DbProperties
		{
			get
			{
				return this.dbProperties;
			}
			set
			{
				this.dbProperties = value;
			}
		}

		// Token: 0x17000072 RID: 114
		// (get) Token: 0x060003DC RID: 988 RVA: 0x002FA4F0 File Offset: 0x002F86F0
		// (set) Token: 0x060003DD RID: 989 RVA: 0x002FA4F8 File Offset: 0x002F86F8
		public virtual bool IfNotExists
		{
			get
			{
				return this.ifNotExists;
			}
			set
			{
				this.ifNotExists = value;
			}
		}

		// Token: 0x060003DE RID: 990 RVA: 0x002FA501 File Offset: 0x002F8701
		public TCreateDatabaseSqlStatement(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstcreatedatabase;
		}

		// Token: 0x060003DF RID: 991 RVA: 0x002FA511 File Offset: 0x002F8711
		internal override void buildsql()
		{
		}

		// Token: 0x060003E0 RID: 992 RVA: 0x002FA513 File Offset: 0x002F8713
		internal override void clear()
		{
		}

		// Token: 0x060003E1 RID: 993 RVA: 0x002FA515 File Offset: 0x002F8715
		internal override string getasprettytext()
		{
			return "";
		}

		// Token: 0x060003E2 RID: 994 RVA: 0x002FA51C File Offset: 0x002F871C
		internal virtual void iterate(TVisitorAbs pvisitor)
		{
		}

		// Token: 0x17000073 RID: 115
		// (get) Token: 0x060003E3 RID: 995 RVA: 0x002FA51E File Offset: 0x002F871E
		// (set) Token: 0x060003E4 RID: 996 RVA: 0x002FA526 File Offset: 0x002F8726
		public virtual TObjectName DatabaseName
		{
			get
			{
				return this.databaseName;
			}
			set
			{
				this.databaseName = value;
			}
		}

		// Token: 0x060003E5 RID: 997 RVA: 0x002FA530 File Offset: 0x002F8730
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			if (this.dbvendor == EDbVendor.dbvdb2)
			{
				TSourceTokenList container = ((TStubStmtSqlNode)this.rootNode).startToken.container;
				for (int i = 0; i < container.size(); i++)
				{
					TSourceToken tsourceToken = container.get(i);
					if (!tsourceToken.isnonsolidtoken() && tsourceToken.tokencode == 264)
					{
						this.databaseName = new TNodeFactory().createObjectName(null, null, tsourceToken);
						this.databaseName.DbObjectType = EDbObjectType.database;
						break;
					}
				}
			}
			else if (this.dbvendor == EDbVendor.dbvmssql)
			{
				TSourceTokenList container2 = ((TMssqlStmtStubSqlNode)this.rootNode).startToken.container;
				for (int j = 0; j < container2.size(); j++)
				{
					TSourceToken tsourceToken2 = container2.get(j);
					if (!tsourceToken2.isnonsolidtoken() && tsourceToken2.tokencode == 264)
					{
						this.databaseName = new TNodeFactory().createObjectName(null, null, tsourceToken2);
						this.databaseName.DbObjectType = EDbObjectType.database;
						break;
					}
				}
			}
			else
			{
				TCreateDatabaseSqlNode tcreateDatabaseSqlNode = (TCreateDatabaseSqlNode)this.rootNode;
				base.doParseStatement(psql);
				this.databaseName = tcreateDatabaseSqlNode.DatabaseName;
				this.database = tcreateDatabaseSqlNode.Database;
				this.dbLocation = tcreateDatabaseSqlNode.DbLocation;
				this.databaseComment = tcreateDatabaseSqlNode.DatabaseComment;
				this.dbProperties = tcreateDatabaseSqlNode.DbProperties;
				this.dbOwner = tcreateDatabaseSqlNode.DbOwner;
				this._characterSet = tcreateDatabaseSqlNode.characterSet;
				this._collationName = tcreateDatabaseSqlNode.collationName;
			}
			base.DatabaseObjects.Add(this.DatabaseName);
			return 0;
		}

		// Token: 0x060003E6 RID: 998 RVA: 0x002FA6CE File Offset: 0x002F88CE
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x060003E7 RID: 999 RVA: 0x002FA6DE File Offset: 0x002F88DE
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x040010C0 RID: 4288
		private TObjectName _characterSet;

		// Token: 0x040010C1 RID: 4289
		private TObjectName _collationName;

		// Token: 0x040010C2 RID: 4290
		private bool ifNotExists;

		// Token: 0x040010C3 RID: 4291
		private TObjectName databaseComment;

		// Token: 0x040010C4 RID: 4292
		private TObjectName dbLocation;

		// Token: 0x040010C5 RID: 4293
		private TSourceToken database;

		// Token: 0x040010C6 RID: 4294
		private THiveWithDBPropertiesClause dbProperties;

		// Token: 0x040010C7 RID: 4295
		private TObjectName dbOwner;

		// Token: 0x040010C8 RID: 4296
		private TObjectName databaseName;
	}
}
